﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dqs_BLL;
using Dqs_DAL;
using Model;
using Sunny.UI;

namespace Dqs_UI
{
	public partial class frmAdmin_Admin : UIForm
	{
		public frmAdmin_Admin()
		{
			InitializeComponent();
		}
		Admin_BLL Admin_BLL = new Admin_BLL();



		private void frmAdmin_Admin_Load(object sender, EventArgs e)
		{
			List<AdminInfo> list = Admin_BLL.GetAdmins();
			dgvStudentInfo.DataSource = list;
		}

		private void btnInsertAdmin_Click(object sender, EventArgs e)
		{
			frmAddAdmin frmAddAdmin = new frmAddAdmin();
			frmAddAdmin.ShowDialog();
			frmAdmin_Admin_Load(this, e);
		}

		private void btnUpdateAdmin_Click(object sender, EventArgs e)
		{
			int id = Convert.ToInt32(dgvStudentInfo.SelectedRows[0].Cells["Id"].Value);
			frmUpdateAdmin frmUpdateAdmin = new frmUpdateAdmin(id);
			frmUpdateAdmin.ShowDialog();
			frmAdmin_Admin_Load(this, e);
		}

		private void btnDeleteAdmin_Click(object sender, EventArgs e)
		{

			int adminid = Convert.ToInt32(dgvStudentInfo.SelectedRows[0].Cells["Id"].Value);
			Admin_BLL.DeleteAdminInfoById(adminid);
			frmAdmin_Admin_Load(this, e);
		}
	}
}
